package com.zhuangjie.rider.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.zhuangjie.mvc.validator.valid.InsertGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author zhuangjie
 * @since 2024-01-03
 */
@Accessors(chain = true)
@TableName("delivery_order")
@ApiModel(value = "DeliveryOrder对象", description = "")
@Getter
@Setter
public class DeliveryOrder implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("配送单编号")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotNull(groups = {InsertGroup.class})
    private Long id;

    @ApiModelProperty("骑手id")
    @TableField("rider_id")
    @NotNull(groups = {InsertGroup.class})
    private Long riderId;

    @ApiModelProperty("订单id")
    @TableField("order_id")
    @NotNull(groups = {InsertGroup.class})
    private Long orderId;

    @ApiModelProperty("店铺id")
    @TableField("shop_id")
    @NotNull(groups = {InsertGroup.class})
    private Long shopId;

    @ApiModelProperty("下单用户id")
    @TableField("user_id")
    @NotNull(groups = {InsertGroup.class})
    private Long userId;

    @ApiModelProperty("店铺的联系电话")
    @TableField("shop_phone")
    @NotNull(groups = {InsertGroup.class})
    private String shopPhone;

    @ApiModelProperty("店铺位置geo-经度")
    @TableField("shop_latitude")
    private Double shopLatitude;

    @ApiModelProperty("店铺位置geo-纬度")
    @TableField("shop_longitude")
    @NotNull(groups = {InsertGroup.class})
    private Double shopLongitude;

    @ApiModelProperty("店铺所在城市code")
    @TableField("shop_city_code")
    private String shopCityCode;

    @ApiModelProperty("比如XXX店")
    @TableField("shop_name")
    @NotNull(groups = {InsertGroup.class})
    private String shopName;

    @ApiModelProperty("商家描述的具体位置")
    @TableField("shop_address_describe")
    private String shopAddressDescribe;

    @ApiModelProperty("收货人姓名")
    @TableField("consignee_fullname")
    @NotNull(groups = {InsertGroup.class})
    private String consigneeFullname;

    @ApiModelProperty("收货人的联系电话")
    @TableField("consignee_phone")
    @NotNull(groups = {InsertGroup.class})
    private String consigneePhone;

    @ApiModelProperty("收货人地址geo-经度")
    @TableField("consignee_latitude")
    @NotNull(groups = {InsertGroup.class})
    private Double consigneeLatitude;

    @ApiModelProperty("收货人收货地址geo-纬度")
    @TableField("consignee_longitude")
    @NotNull(groups = {InsertGroup.class})
    private Double consigneeLongitude;

    @ApiModelProperty("收货人所在城市code")
    @TableField("consignee_city_code")
    private String consigneeCityCode;

    @ApiModelProperty("收货人收货位置名称（如XX公寓）")
    @TableField("consignee_address_name")
    @NotNull(groups = {InsertGroup.class})
    private String consigneeAddressName;

    @ApiModelProperty("收货人收货地址描述的具体位置")
    @TableField("consignee_address_describe")
    private String consigneeAddressDescribe;

    @ApiModelProperty("1 待骑手接单 2 骑手已接单 3骑手已到店 4 骑手已取单 5 已交付给用户")
    @TableField("delivery_state")
    private Integer deliveryState;

    @ApiModelProperty("1 待完成 2 待入账 3 已入账")
    @TableField("income_state")
    private Integer incomeState;

    @ApiModelProperty("完成后骑手所得收益（并非实际收益，超时后开始扣款，当超时达到配送时间时收益为-50%）")
    @TableField("income")
    private BigDecimal income;

    @ApiModelProperty("店铺的餐号")
    @TableField("code")
    private Integer code;

    @ApiModelProperty(value = "用户指定的送达时间")
    @TableField("designated_delivery_time")
    private LocalDateTime designatedDeliveryTime;

    @ApiModelProperty("配送时长（分钟）")
    @TableField("delivery_duration")
    private Integer deliveryDuration;

    @ApiModelProperty("交付时间")
    @TableField("delivery_time")
    private LocalDateTime deliveryTime;

    @ApiModelProperty("指定的骑手id（null时表示可自由抢单）")
    @TableField("assign_rider_id")
    private Long assignRiderId;

    @ApiModelProperty("账单记录id")
    @TableField("transfer_accounts_id")
    private Long transferAccountsId;

    @ApiModelProperty(value = "配送方式（1平台配送，2商家配送）")
    @TableField("delivery_method")
    private Short deliveryMethod;

    @ApiModelProperty("可见范围")
    @TableField("visible_range")
    private Double visibleRange;

    @ApiModelProperty("创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
